package edu.its.dreamteam.web.base;


import org.apache.tapestry.annotations.InjectPage;

import edu.its.dreamteam.web.pages.Start;

/**
 * Base page for pages that must not be accessible if the user is not logged in.
 */
public class SecureBasePage extends SimpleBasePage {
	
	@InjectPage
	private Start _start;
	
	/**
	 * Validate that the user is logged in.  If not logged in, then redirects to the login page.
	 */
	Object onActivate() {

		if (!isVisitExists() || !getVisit().isLoggedIn()) {
			return _start;
		}

		return null;
	}
}
